import React, { Fragment } from 'react';
import AttrRender from './AttrRender';
import RouteRender from './RouteRender';
import SpaceWrapper from './SpaceWrapper';

/**
 * 对象
 * @param param0
 * @returns
 */
export default function ObjectRender(_ref) {
  var data = _ref.data,
    _ref$depth = _ref.depth,
    depth = _ref$depth === void 0 ? 0 : _ref$depth;
  var keys = Object.keys(data);
  var space = ' ';
  return /*#__PURE__*/ React.createElement(
    Fragment,
    null,
    /*#__PURE__*/ React.createElement(
      SpaceWrapper,
      {
        depth: depth,
      },
      '{',
    ),
    keys.length ? /*#__PURE__*/ React.createElement('br', null) : null,
    keys.map(function (attr, index) {
      return (
        /*#__PURE__*/
        // eslint-disable-next-line
        React.createElement(
          Fragment,
          {
            key: index,
          },
          /*#__PURE__*/ React.createElement(AttrRender, {
            data: attr,
            depth: depth + 1,
          }),
          ':',
          space,
          /*#__PURE__*/ React.createElement(RouteRender, {
            data: data[attr],
            depth: depth + 1,
            spaceable: false,
          }),
          ',',
          index === keys.length - 1 ? null : /*#__PURE__*/ React.createElement('br', null),
        )
      );
    }),
    /*#__PURE__*/ React.createElement('br', null),
    /*#__PURE__*/ React.createElement(
      SpaceWrapper,
      {
        depth: depth,
      },
      '}',
    ),
  );
}
